package com.restart.game.controller;

import com.restart.game.common.util.filter.NoticeFilterConf;
import com.restart.game.entity.Conf;
import com.restart.game.service.ConfService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author ReStartLin
 * @data 2018/12/12 20:41
 * @classDesc: 功能描述:
 */
@Controller
@RequestMapping("api/conf")
public class ConfController {
    public static final Logger logger = LoggerFactory.getLogger(ConfController.class);

    private final ConfService confService;

    @Autowired
    public ConfController(ConfService confService) {
        this.confService = confService;
    }

    @PostMapping("set")
    public String setConf(Conf conf) {
        if (conf.getId() != null) {
            confService.updateByPrimaryKey(conf);
            NoticeFilterConf.getInstance().upData();
        }
        return "info/success";
    }
}
